package com.ctrip.cap.ui;

import io.appium.java_client.AppiumDriver;

import org.openqa.selenium.WebDriver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.ctrip.cap.device.Device;
import com.ctrip.cap.device.DeviceStoreFactory;
import com.ctrip.cap.internal.domain.Context;
import com.ctrip.cap.lanucher.AppiumConfig;
import com.ctrip.cap.lanucher.AppiumServer;

/**
 * UI
 *
 * @author sqou
 */
public class UIContext extends Context {

    private static final Logger logger = LoggerFactory
            .getLogger(UIContext.class);
   
    private WebDriver driver;

    public WebDriver getDriver() {
        return driver;
    }

    public void setDriver(WebDriver driver) {
        this.driver = driver;
    }

   /**
    * colse driver
    */

    public void closeQuietly() {
        try {
            if (driver != null) {
                driver.quit();
                this.driver = null;
            }
        } catch (Exception e) {
            logger.warn("", e);
        }
    }

}
